home *** CD-ROM | disk | FTP | other *** search
/ Computer Life: SuperPac / SuperPac (Computer Life Magazine)(Ziff-Davis)(1995).ISO / pc / demos / nile / senet.exe / senet.DXR / 00067_The Real Pass Button Script.ls < prev    next >
Encoding:
Text File  |  1995-05-04  |  2.0 KB  |  75 lines

  1. on mouseDown
  2.   global canPass
  3.   set canPass to 0
  4.   set the castNum of sprite the clickOn to the number of cast "Pass.Down"
  5.   updateStage()
  6.   if passable() then
  7.     set canPass to 1
  8.   end if
  9. end
  10.  
  11. on mouseUp
  12.   global theSenetGame, canPass
  13.   set the castNum of sprite the clickOn to the number of cast "Pass.Up"
  14.   puppetSound("Pass")
  15.   updateStage()
  16.   if canPass then
  17.     passTurn(theSenetGame)
  18.   end if
  19. end
  20.  
  21. on passable
  22.   global theSenetGame, aMoveMade
  23.   if aMoveMade then
  24.     set temptext to the text of cast "TheMsg"
  25.     set the text of cast "TheMsg" to "You must first roll the dice."
  26.     updateStage()
  27.     repeat while the mouseDown
  28.       nothing()
  29.     end repeat
  30.     set the text of cast "TheMsg" to temptext
  31.     updateStage()
  32.     return 0
  33.   else
  34.     set legalMove to 0
  35.     if the playerMoving of theSenetGame = 1 then
  36.       set PLAYER to "Player 1"
  37.     else
  38.       set PLAYER to "Player 2"
  39.     end if
  40.     if the text of cast PLAYER = "Light" then
  41.       repeat with x = 1 to count(the whitePiecesSpriteList of theSenetGame)
  42.         set aMove to generateALegalMove(theSenetGame, getAt(the whitePiecesSpriteList of theSenetGame, x))
  43.         if aMove <> 0 then
  44.           set legalMove to 1
  45.           exit repeat
  46.         end if
  47.       end repeat
  48.     else
  49.       repeat with x = 1 to count(the blackPiecesSpriteList of theSenetGame)
  50.         set aMove to generateALegalMove(theSenetGame, getAt(the blackPiecesSpriteList of theSenetGame, x))
  51.         if aMove <> 0 then
  52.           set legalMove to 1
  53.           exit repeat
  54.         end if
  55.       end repeat
  56.     end if
  57.     if legalMove then
  58.       set temptext to the text of cast "TheMsg"
  59.       set the text of cast "TheMsg" to "You cannot pass; a legal move is available."
  60.       updateStage()
  61.       repeat while the mouseDown
  62.         nothing()
  63.       end repeat
  64.       set the text of cast "TheMsg" to temptext
  65.       updateStage()
  66.       return 0
  67.     else
  68.       repeat while the mouseDown
  69.         nothing()
  70.       end repeat
  71.       return 1
  72.     end if
  73.   end if
  74. end
  75.